home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Util / Commodities / DFA-25.lha / DFA-25 / Archive / DFA.lha / Rexx / importadm.dfa < prev    next >
Text File  |  1995-05-25  |  5KB  |  167 lines

  1. /* $Revision Header built automatically *************** (do not edit) ************
  2. **
  3. ** © Copyright by Dirk Federlein
  4. **
  5. ** File             : importadm.dfa
  6. ** Created on       : Friday, 01.04.94 12:29:21
  7. ** Created by       : Dirk Federlein
  8. ** Current revision : V2.0
  9. **
  10. **
  11. ** Purpose
  12. ** -------
  13. **
  14. ** If you've used ADM (what a shame:-)) up to now to manage
  15. ** your addresses, this script will help you to switch to DFA 
  16. ** without loosing any data or even reentering all of your
  17. ** addresses!
  18. **
  19. ** It imports all addresses currently available from a running
  20. ** ADM application.
  21. **
  22. **
  23. ** This script should be binded to a function key of DFA, but
  24. ** will work as well, if you start it from the shell using the
  25. ** 'rx' command of Arexx, i.e. 'rx importadm.dfa'. Of course, you
  26. ** have to make sure that DFA _and_ ADM are currently running!
  27. **
  28. ** Please note that it is not possible to import the addresses
  29. ** 1:1 as not all fields exist in ADM _and_ DFA. The following
  30. ** translation is made:
  31. **
  32. ** -------------------------------------------------------------
  33. **         ADM                -->           DFA
  34. **         ---                              ===
  35. ** SALUTATION + COMPANY                  SALUTATION
  36. **  REMARK1 + REMARK2                     COMMENT
  37. **       <empty>                           EMAIL3
  38. **  ADDRESS Line # 1                       STREET
  39. **  ADDRESS Line # 2                         CO
  40. **         ID                             <empty>
  41. **       <empty>                           STATE
  42. ** -------------------------------------------------------------
  43. **
  44. ** The other strings are taken 1:1
  45. **
  46. ** Please notice that the <empty> string above means that either
  47. ** ADM or DFA does not support this field and it is not imported
  48. ** into DFA, i.e. for example that the 'EMail3' field of DFA will
  49. ** stay empty! Of course you may modify the translation described
  50. ** above to fit you needs.
  51. **
  52. ** Group flags 1-8 of ADM are put into DFA. Flags 9 and 10 of ADM
  53. ** are not imported.
  54. **
  55. **
  56. ** Revision V2.0
  57. ** --------------
  58. ** created on Friday, 01.04.94 12:29:21  by  Dirk Federlein.   LogMessage :
  59. **     --- Initial release ---
  60. **
  61. *********************************************************************************/
  62.  
  63. options results
  64.  
  65. cr    = '0A'X
  66. quote    = '22'X
  67.  
  68. if ~show(ports, DFA) then
  69.     exit 10
  70.  
  71. if ~show(ports, ADM.1) then
  72.     exit 20
  73.  
  74.  
  75.     /* --- ADM: Get number of addresses available ----------------------- */
  76.  
  77. ADDRESS 'ADM.1' ADDRINMEM
  78.  
  79. numadr = RESULT
  80.  
  81.     /* --- ADM: Activate first entry ------------------------------------ */
  82.  
  83. ADDRESS 'ADM.1' ACTIVATEFIRST
  84.  
  85. DO FOR numadr
  86.  
  87.         /* --- ADM: Get current address and put it into 'ADMADDRESS' ---- */
  88.  
  89.     ADDRESS 'ADM.1' GETADDRESS ADMADDRESS
  90.  
  91.         /* --- DFA: Insert new address ---------------------------------- */
  92.  
  93.     ALLFLAGS    = ADMADDRESS.FLAGS
  94.  
  95.         /* --- Cut flag 9 and 10 if set in ADM as DFA only supports up -- */
  96.         /* --- to 8 flags ----------------------------------------------- */
  97.  
  98.     if (ALLFLAGS % 512) = 1 then
  99.         ALLFLAGS = ALLFLAGS - 512
  100.  
  101.     if (ALLFLAGS % 256) = 1 then
  102.         ALLFLAGS = ALLFLAGS - 256
  103.  
  104.         /* --- Build 'flags' string from ADM's 'flags' field ------------ */
  105.         /* --- NB: ADM uses a _VERY_ inconvenient way to store its ------ */
  106.         /* --- group flags. --------------------------------------------- */
  107.  
  108.     FLAGSTRING    = ""
  109.  
  110.     if (ALLFLAGS % 128) = 1 then
  111.     do
  112.         ALLFLAGS = ALLFLAGS - 128
  113.         FLAGSTRING='GROUP8'
  114.     end
  115.  
  116.     if (ALLFLAGS % 64) = 1 then
  117.     do
  118.         ALLFLAGS = ALLFLAGS - 64
  119.         FLAGSTRING=FLAGSTRING 'GROUP7'
  120.     end
  121.  
  122.     if (ALLFLAGS % 32) = 1 then
  123.     do
  124.         ALLFLAGS = ALLFLAGS - 32
  125.         FLAGSTRING=FLAGSTRING 'GROUP6'
  126.     end
  127.  
  128.     if (ALLFLAGS % 16) = 1 then
  129.     do
  130.         ALLFLAGS = ALLFLAGS - 16
  131.         FLAGSTRING=FLAGSTRING 'GROUP5'
  132.     end
  133.  
  134.     if (ALLFLAGS % 8) = 1 then
  135.     do
  136.         ALLFLAGS = ALLFLAGS - 8
  137.         FLAGSTRING=FLAGSTRING 'GROUP4'
  138.     end
  139.  
  140.     if (ALLFLAGS % 4) = 1 then
  141.     do
  142.         ALLFLAGS = ALLFLAGS - 4
  143.         FLAGSTRING=FLAGSTRING 'GROUP3'
  144.     end
  145.  
  146.     if (ALLFLAGS % 2) = 1 then
  147.     do
  148.         ALLFLAGS = ALLFLAGS - 2
  149.         FLAGSTRING=FLAGSTRING 'GROUP2'
  150.     end
  151.  
  152.     if (ALLFLAGS % 1) = 1 then
  153.     do
  154.         ALLFLAGS = ALLFLAGS - 1
  155.         FLAGSTRING=FLAGSTRING 'GROUP1'
  156.     end
  157.  
  158.     ADDRESS 'DFA' 'NEW' 'SALUTATION='quote||ADMADDRESS.SALUTATION ADMADDRESS.COMPANY||quote 'NAME='quote||ADMADDRESS.LASTNAME||quote 'FIRST='quote||ADMADDRESS.FIRSTNAME||quote 'CO='quote||ADMADDRESS.ADDRESS2||quote 'STREET='quote||ADMADDRESS.ADDRESS1||quote 'ZIP='quote||ADMADDRESS.POSTCODE||quote 'CITY='quote||ADMADDRESS.CITY||quote 'BIRTHDAY='quote||ADMADDRESS.BIRTHDAY||quote 'PHONE='quote||ADMADDRESS.TELEPHONE||quote 'FAX='quote||ADMADDRESS.FAX||quote  'EMAIL1='quote||ADMADDRESS.EMAIL1||quote 'EMAIL2='quote||ADMADDRESS.EMAIL2||quote 'COMMENT='quote||ADMADDRESS.REMARK1 ADMADDRESS.REMARK2||quote FLAGSTRING
  159.  
  160.         /* --- ADM: Next entry ------------------------------------------ */
  161.  
  162.     ADDRESS 'ADM.1' ACTIVATENEXT
  163.  
  164. END
  165.  
  166. EXIT
  167.